<include file="public@header" />
<style>
    .new-form-control{
        padding-top: 7px;
    }
</style>
</head>
<body>
<div class="wrap">
    <include file="public@nav" />
    <div class="form-horizontal js-ajax-form margin-top-20" style="float:left;width: 69%;padding-left: 50px;">
        <div class="form-group">
            <label for="input-user_login" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务名</label>
            <div class="new-form-control col-md-6 col-sm-10">
                {$list.task_title}
            </div>

        </div>

        <div class="form-group">
            <label for="input-user_login" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务类型</label>
            <div class="new-form-control col-md-6 col-sm-10">
                <switch name="$list.task_multiplayer">
                    <case value="0">
                        <span class="label label-danger">单人任务</span>
                    </case>
                    <case value="1">
                        <span class="label label-success">多人任务</span>
                    </case>
                    <case value="2">
                        <span class="label label-warning">部门任务</span>
                    </case>
                    <case value="3">
                        <span class="label label-warning">标签任务</span>
                    </case>
                </switch>
            </div>

        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                所属项目
            </label>
            <div class="new-form-control col-md-6 col-sm-10">
                {$list.project_title|default='无'}
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务内容
            </label>
            <div class="new-form-control col-md-6 col-sm-10">
                {$list.task_content}
            </div>

        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>优先级
            </label>
            <div class="new-form-control col-md-6 col-sm-10">

                <switch name="$list.task_priority">
                    <case value="1">
                        <span class="label label-danger">正常</span>
                    </case>
                    <case value="2">
                        <span class="label label-success">次要</span>
                    </case>
                    <case value="3">
                        <span class="label label-warning">主要</span>
                    </case>
                    <case value="4">
                        <span class="label label-warning">紧急</span>
                    </case>
                    <case value="5">
                        <span class="label label-warning">严重</span>
                    </case>
                </switch>
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>状态
            </label>
            <div class="new-form-control col-md-6 col-sm-10">
                <switch name="$list.task_status">
                    <case value="0">
                        <span class="label label-danger">待办</span>
                    </case>
                    <case value="1">
                        <span class="label label-success">进行</span>
                    </case>
                    <case value="2">
                        <span class="label label-warning">审核</span>
                    </case>
                    <case value="3">
                        <span class="label label-warning">完成</span>
                    </case>
                    <case value="4">
                        <span class="label label-warning">审核失败</span>
                    </case>
                    <case value="10">
                        <span class="label label-warning">关闭</span>
                    </case>
                </switch>

            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务开始时间
            </label>
            <div class="new-form-control col-md-6 col-sm-10">
                {$list.task_start_time|date="Y-m-d H:i:s"}
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务结束时间
            </label>
            <div class="new-form-control col-md-6 col-sm-10">
                {$list.task_end_time|date="Y-m-d H:i:s"}
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务价值分
            </label>
            <div class="new-form-control col-md-6 col-sm-10">
                {$list.task_mark}
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务完成时间
            </label>
            <div class="new-form-control col-md-6 col-sm-10">
                {$list.task_complete_time|date="Y-m-d H:i:s"}
            </div>
        </div>
        <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('task/examineStatus')}">
            <div class="form-group">
                <label for="input-user_pass" class="col-sm-2 control-label">
                    <span class="form-required">*</span>审核状态
                </label>
                <div class="new-form-control col-md-6 col-sm-10">
                    <input type="radio" name="task_status" value="3" checked> 通过
                    <input type="radio" name="task_status" value="5"> 不通过
                    <!--<select class="" name="task_status">

                        <option value="3" >通过</option>
                        <option value="4" >不通过</option>
                    </select>-->
                </div>
            </div>
            <div class="form-group">
                <label for="input-user_pass" class="col-sm-2 control-label">
                    审核记录
                </label>
                <div class="new-form-control col-md-6 col-sm-10">
                    <input type="hidden" name="taskid" value="{$list.task_id}">
                    <textarea name="task_dynamic_content" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
                </div>
            </div>
        </form>
    </div>
    <div class="form-horizontal js-ajax-form margin-top-20" style="border:1px solid #006fc4;;border-radius:5px;width: 29%;padding-left: 10px;float: right;">
        <h5>任务动态</h5>
        <foreach name="dynamic" item="voo">
            <ul>
            <li class="" style=" list-style: none">
                    人&nbsp;&nbsp;员： {$voo.user_nickname}
            </li>
            <li style=" list-style: none">
                    时&nbsp;&nbsp;间： {$voo.task_dynamic_createtime|date="Y-m-d H:i:s"}
            </li>
                <li style=" list-style: none">
                    标&nbsp;&nbsp;题： {$voo.task_dynamic_title}
                </li>
            <li style=" list-style: none">
                    内&nbsp;&nbsp;容： {$voo.task_dynamic_content}
            </li>
            </ul>
        </foreach>

    </div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $('#department').change(function() {
        var department = $(this).val()
        if(department == ""){
            return
        }
        $.ajax({
            url:"{:Url('task/getUserByDepartment')}",
            data:{
                id:department
            },
            type:'post',
            dataType:'json',
            success:function(xhr){
                var html ='<option>选择人员</option>'
                var project= ''
                var  division = xhr.data
                for (x in division) {
                    html += '<option   value="'+division[x].id+'">'+division[x].user_login+'--'+division[x].user_nickname+'</option>'
                }
                $("#userlist").html(html)
                /* for (x in rule) {
                     project += '<option   value="'+rule[x].project+'">'+rule[x].project+'</option>'
                 }
                 $("#rule").html(project);*/
            }
        });
    })
    $('.changeTaskStatus').change(function() {
        var status = $(this).val()
        var taskid  =   $(this).attr("data-msg");
        $.ajax({
            url:"{:Url('task/changeTaskStatus')}",
            data:{
                status:status,
                taskid:taskid
            },
            type:'post',
            dataType:'json',
            success:function(xhr){
                location.reload(true)
            }
        });
    })
</script>
</body>
</html>